package com.burstly.lib.network.request;

import com.burstly.lib.network.ResponseObject;
import com.burstly.lib.network.beans.ResponseBean;
import com.burstly.lib.network.beans.TrackClickResult;
import com.burstly.lib.util.Utils;
import java.util.HashMap;
import java.util.Map;

final class ConverterFactory
{
  private static final Map<String, IResponseConverter<?>> CACHE = new HashMap(5);

  static <T> IResponseConverter<T> getConverter(Class<T> paramClass)
  {
    String str = paramClass.getCanonicalName();
    if (CACHE.containsKey(str))
      return (IResponseConverter)CACHE.get(str);
    IResponseConverter localIResponseConverter = getSpecificConverter(paramClass);
    CACHE.put(str, localIResponseConverter);
    return localIResponseConverter;
  }

  private static <T> IResponseConverter<T> getSpecificConverter(Class<T> paramClass)
  {
    if (paramClass.equals(ResponseObject.class))
      return new IResponseConverter()
      {
        public T convertResponse(String paramAnonymousString)
        {
          return Utils.fromJson(paramAnonymousString);
        }
      };
    if ((paramClass.equals(ResponseBean.class)) || (paramClass.equals(TrackClickResult.class)))
      return new IResponseConverter()
      {
        public T convertResponse(String paramAnonymousString)
        {
          return Utils.fromJson(paramAnonymousString, this.val$targetClass);
        }
      };
    if (paramClass.equals(String.class))
      return new IResponseConverter()
      {
        public T convertResponse(String paramAnonymousString)
        {
          return paramAnonymousString;
        }
      };
    return null;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.network.request.ConverterFactory
 * JD-Core Version:    0.6.2
 */